﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace sy3_4
{
    public class Truck : Vehicle
    {
        private double load;      
        private double maxLoad;   
        private double oilPerKm;  
        private double distance;  

        public Truck() : base() { }
        public Truck(int wheelCount, double weight, double load, double maxLoad, double oilPerKm, double distance)
            : base(wheelCount, weight)
        {
            this.load = load;
            this.maxLoad = maxLoad;
            this.oilPerKm = oilPerKm;
            this.distance = distance;
        }

        public void SetVehicle(int wheelCount, double weight, double load, double maxLoad, double oilPerKm, double distance)
        {
            base.SetVehicle(wheelCount, weight); 
            this.load = load;
            this.maxLoad = maxLoad;
            this.oilPerKm = oilPerKm;
            this.distance = distance;
        }

        public new string GetVehicle()
        {
            return base.GetVehicle() + $"\n载货量：{load}吨\n最大载重量：{maxLoad}吨\n每公里耗油：{oilPerKm}L\n行驶公里数：{distance}公里";
        }

        public bool IsOverload()
        {
            return load > maxLoad;
        }

        public double CalculateTotalOil()
        {
            return oilPerKm * distance;
        }
    }
}
